package com.wzb.mybatisplus.bitaction;


import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ForkJoinPool;

/**
 * 档案线程池
 * @author lcr
 * @since 2023-05-01 13:33
 */
public class BitThreadPool {
    public static void main(String[] args) {
        for (int i=0;i<=1000;i++){

        }
    }

    private BitThreadPool(){

    }

    private static class ThreadPoolHolder{
        private static int  size = getThreadSum();
        private static ExecutorService threadPool = Executors.newFixedThreadPool(size);

        private static int getThreadSum(){
//            String count = 10;
            try{
                return 10;
            }catch (Exception e) {
                return 2;
            }
        }
    }

    private static class ForkJoinPoolHolder{
        private static ForkJoinPool forkjoinPool = new ForkJoinPool();
    }

    public static ExecutorService getThreadPoolInstance(){
        return ThreadPoolHolder.threadPool;
    }

    public static ForkJoinPool getForkJoinPoolInstance(){
        return ForkJoinPoolHolder.forkjoinPool;
    }

    private static int getThreadSum(){
//        String count = BaseDdctUtil.getDctVal("ocrConfig","ocr线程数量");
        try{
            return 10;
        }catch (Exception e) {
            return 0;
        }
    }

}
